package de.uni.muenster.idw2.autoverbal.data;

import java.util.Scanner;

import de.uni.muenster.idw2.data.Vertex;


public class Angle {

	public static int angle(Vertex v1, Vertex v2, Vertex v3){
		double x1,x2,y1,y2,x3,y3, dp1p2, dp2p3, dp1p3;
		x1 = v1.getCoord().getX();
		y1 = v1.getCoord().getY();
		x2 = v2.getCoord().getX();
		y2 = v2.getCoord().getY();
		x3 = v3.getCoord().getX();
		y3 = v3.getCoord().getY();
		
		dp1p2=Math.sqrt(((x2-x1)*(x2-x1)) +  ((y2-y1)*(y2-y1))); // distance between initial node and mid node
		dp2p3=Math.sqrt(((x3-x2)*(x3-x2)) +  ((y3-y2)*(y3-y2))); // distance between mid node and end node
		dp1p3=Math.sqrt(((x3-x1)*(x3-x1)) +  ((y3-y1)*(y3-y1))); // distance between initial node and end node
		
		// the angle c is the angle at mid node (formed by two edges with initial node and end node)
		// can be calculated using arc cos as below 
		
		double c= Math.acos(((dp1p2*dp1p2) + (dp2p3*dp2p3) - (dp1p3*dp1p3))/(2*dp1p2*dp2p3));
		
		// convert it to degree 
		
		double ang=Math.toDegrees(c);
		// System.out.println(ang);
		
		// decide the orientation 
		
		if(x3>=x2 && ang>45 && ang<=135 )
		{
			//System.out.println(ang + "Degree to the right");
			return Pair.RIGHT;
		}
		
		else if(x3<=x2 && ang>45  && ang<=135 )
		{
			//System.out.println(ang + "Degree to the left");
			return Pair.LEFT;
		}
		
		else if(ang>135 && ang<=180 )
		{
			//System.out.println(ang + ": Straight");
			return Pair.STRAIGHT;
		}
		else{
			return Pair.BACK;
		}
		
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		
		double x1,x2,y1,y2,x3,y3, dp1p2, dp2p3, dp1p3;
		Scanner s=new Scanner(System.in);
		x1=s.nextDouble(); // initial node x-coordinate  
		y1=s.nextDouble(); // initial node y-coordinate
		x2=s.nextDouble();  // mid node x - coordinate 
		y2=s.nextDouble();  // mid node y - coordinate 
		x3=s.nextDouble();  // end node  x-coordinate 
		y3=s.nextDouble();  // end node y -coordinate 
		
		// find distance between each edge 
		
		dp1p2=Math.sqrt(((x2-x1)*(x2-x1)) +  ((y2-y1)*(y2-y1))); // distance between initial node and mid node
		dp2p3=Math.sqrt(((x3-x2)*(x3-x2)) +  ((y3-y2)*(y3-y2))); // distance between mid node and end node
		dp1p3=Math.sqrt(((x3-x1)*(x3-x1)) +  ((y3-y1)*(y3-y1))); // distance between initial node and end node
		
		// the angle c is the angle at mid node (formed by two edges with initial node and end node)
		// can be calculated using arc cos as below 
		
		double c= Math.acos(((dp1p2*dp1p2) + (dp2p3*dp2p3) - (dp1p3*dp1p3))/(2*dp1p2*dp2p3));
		
		// convert it to degree 
		
		double ang=Math.toDegrees(c);
		// System.out.println(ang);
		
		// decide the orientation 
		
		if(x3>=x2 && ang>45 && ang<=135 )
		{
			System.out.println(ang + "Degree to the right");
		}
		
		else if(x3<=x2 && ang>45  && ang<=135 )
		{
			System.out.println(ang + "Degree to the left");
		}
		
		else if(ang>135 && ang<=180 )
		{
			System.out.println(ang + ": Straight");
		}
		
		
		

		
		
		//System.out.println(c);
		
		

	}

}
